<#assign f = JspTaglibs["http://www.casic304.cn/f"] />
<div>
    <table id="wQbdQualityCostTable" lay-filter="wQbdQualityCostTable"></table>
    <form class="reportList-isShow">
        <input type="hidden" id="successDataId" name="successDataId">
    </form>
</div>
<!-- 右侧工具栏 -->
<script type="text/html" id="wQbdQualityCostRightToolsBar">

    <a class="RightBtn" lay-event="particulars">详情</a>

</script>

<script>
    //一般直接写在一个js文件中
    layui.use(['table', 'publicMethods','jquery','layer'], function () {
        var table = layui.table;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var layer = layui.layer;

        var tableH=publicMethods.layerHeight();
        var dataId = "${dataId}";

        //第一个实例
        table.render({
            elem: '#wQbdQualityCostTable'
            ,height:tableH
            ,url: serverPath.qbdmsPath + '/qbdms/wQbdQualityCost/reportList?id='+dataId+"&tableName=W_QBD_QUALITY_COST"
            ,method: 'post'
            ,autoSort: false //是否排序
            ,cols: [[ //表头
                {type: 'checkbox', fixed: 'left'}
                ,{field: 'sn', type: 'numbers', title: '序号', fixed: 'left'}
                ,{field: 'id', title: '主键id',hide:true,sort:true, sortname: 'id'}
                ,{field: 'filldate', title: '填写日期',minWidth: 110,}
                ,{field: 'companyName', title: '单位名称',hide:true}
                ,{field: 'secret', title: '密级',hide:true}
                //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.year,"1");
                //如需转换为HH:mm:ss: return publicMethods.timeData(d.year,"2");
                // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.year);
                ,{field: 'year', title: '年度',minWidth: 80, templet: function (d) {
                    return publicMethods.timeData(d.year,"3");
                }}
                ,{field: 'statisticalPeriod', title: '统计期',minWidth: 100}
                ,{field: 'modelName', title: '型号名称',minWidth: 110}
                ,{field: 'modelCode', title: '型号代号',minWidth: 110}
                ,{field: 'modelType', title: '型号类别',minWidth: 110}
                ,{field: 'preventionCost', title: '预防成本(万元)',minWidth: 140}
                ,{field: 'qualityOperatingExpenses', title: '质量工作费(万元)',hide:true}
                ,{field: 'qualityEdducationTrainFee', title: '质量教育培训费(万元)',hide:true}
                ,{field: 'qualityReviewFee', title: '质量评审费(万元)',hide:true}
                ,{field: 'qualityIncentiveFee', title: '质量奖励费(万元)',hide:true}
                ,{field: 'qualityInprovementMeasure', title: '质量改进措施费(万元)',hide:true}
                ,{field: 'qualityManagementPersonnel', title: '质量管理人员薪酬(万元)',hide:true}
                ,{field: 'appraisalCosts', title: '鉴定成本(万元)', minWidth: 130}
                ,{field: 'inspectionTestOfficeExpense', title: '检验试验办公费(万元)',hide:true,}
                ,{field: 'equipmentDepreciationCost', title: '检验宿舍被折旧费(万元)',hide:true}
                ,{field: 'inspectionTestFee', title: '检验试验费(万元)',hide:true}
                ,{field: 'salaryAppraisers', title: '鉴定人员薪酬(万元)',hide:true}
                ,{field: 'equipmentMaintenance', title: '检验设备维护校对费(万元)',hide:true}
                ,{field: 'appraisalCostOther', title: '鉴定成本其他(万元)',hide:true}
                ,{field: 'internalFailureCost', title: '内部故障成本(万元)', minWidth: 160}
                ,{field: 'scrapLossExpenses', title: '报废损失费(万元)',hide:true}
                ,{field: 'changeDesignLossFee', title: '更改设计损失费(万元)',hide:true}
                ,{field: 'sparePartsCost', title: '备件损失(万元)',hide:true}
                ,{field: 'accidentAnalysisLoss', title: '事故分析损失费(万元)',hide:true}
                ,{field: 'reworkRepairLoss', title: '返工返修损失费(万元)',hide:true}
                ,{field: 'productDegradationLossFee', title: '产品降级损失费(万元)',hide:true}
                ,{field: 'stopLoss', title: '停工损失(万元)',hide:true}
                ,{field: 'testLoss', title: '试验损失费(万元)',hide:true}
                ,{field: 'internalFailureCostOther', title: '内部故障成本其他(万元)',hide:true}
                ,{field: 'externalFailureCost', title: '外部故障成本(万元)', minWidth: 160}
                ,{field: 'claimForLoss', title: '索赔损失费(万元)',hide:true}
                ,{field: 'productPriceReductionLoss', title: '产品降价损失费(万元)',hide:true}
                ,{field: 'lossOnReturns', title: '退货损失费(万元)',hide:true}
                ,{field: 'legalFees', title: '诉讼费(万元)',hide:true}
                ,{field: 'maintenanceFee', title: '保修费(万元)',hide:true}
                ,{field: 'externalFailureCostOther', title: '外部故障成本其他(万元)',hide:true}
                ,{field: 'externalFailureCostA', title: '外部故障成本(A)(万元)',hide:true}
                ,{field: 'claimForLossA', title: '索赔损失费(A)(万元)',hide:true}
                ,{field: 'productPriceReductionLossA', title: '产品降价损失费(A)(万元)',hide:true}
                ,{field: 'lossOnReturnsA', title: '退货损失费(A)(万元)',hide:true}
                ,{field: 'legalFeesA', title: '诉讼费(A)(万元)',hide:true}
                ,{field: 'maintenanceFeeA', title: '保修费(A)(万元)',hide:true}
                ,{field: 'externalFailureCostOtherA', title: '外部故障成本其他(A)(万元)',hide:true}
                ,{field: 'externalFailureCostB', title: '外部故障成本(B)(万元)',hide:true}
                ,{field: 'claimForLossB', title: '索赔损失费(B)(万元)',hide:true}
                ,{field: 'productPriceReductionLossB', title: '产品降价损失费(B)(万元)',hide:true}
                ,{field: 'lossOnReturnsB', title: '退货损失费(B)(万元)',hide:true}
                ,{field: 'legalFeesB', title: '诉讼费(B)(万元)',hide:true}
                ,{field: 'maintenanceFeeB', title: '保修费(B)(万元)',hide:true}
                ,{field: 'externalFailureCostOtherB', title: '外部故障成本其他(B)(万元)',hide:true}
                ,{field: 'externalFailureCostC', title: '外部故障成本(C)(万元)',hide:true}
                ,{field: 'claimForLossC', title: '索赔损失费(C)(万元)',hide:true}
                ,{field: 'productPriceReductionLossC', title: '产品降价损失费(C)(万元)',hide:true}
                ,{field: 'lossOnReturnsC', title: '退货损失费(C)(万元)',hide:true}
                ,{field: 'legalFeesC', title: '诉讼费(C)(万元)',hide:true}
                ,{field: 'maintenanceFeeC', title: '保修费(C)(万元)',hide:true}
                ,{field: 'externalFailureCostOtherC', title: '外部故障成本其他(C)(万元)',hide:true}
                ,{field: 'totalMilitaryRevenue', title: '军品营业总收入（财务快报数）(万元)',hide:true}
                ,{field: 'totalMilitaryOperatingCost', title: '军品营业总成本（财务快报数）(万元)',hide:true}
                ,{field: 'fillman', title: '填写人',hide:true}
                //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.filldate,"1");
                //如需转换为HH:mm:ss: return publicMethods.timeData(d.filldate,"2");
                // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.filldate);
                ,{field: 'filldate', title: '填写日期',hide:true,templet: function (d) {
                    return publicMethods.timeData(d.filldate);
                }}
                ,{field: 'fillmanaccount', title: '填写人账号',hide:true}
                ,{field: 'filldept', title: '填写部门',hide:true}
                ,{field: 'filldeptid', title: '填写部门编码',hide:true}
                ,{field: 'tenantId', title: '租户Id',hide:true}
                ,{field: 'createBy', title: '创建人',hide:true}
                //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.createTime,"1");
                //如需转换为HH:mm:ss: return publicMethods.timeData(d.createTime,"2");
                // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.createTime);
                ,{field: 'createTime', title: '创建时间',hide:true,templet: function (d) {
                    return publicMethods.timeData(d.createTime);
                }}
                ,{field: 'updateBy', title: '更新人',hide:true}
                //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.updateTime,"1");
                //如需转换为HH:mm:ss: return publicMethods.timeData(d.updateTime,"2");
                // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.updateTime);
                ,{field: 'updateTime', title: '更新时间',hide:true,templet: function (d) {
                    return publicMethods.timeData(d.updateTime);
                }}
                ,{field: 'belongdeptname', title: '所属单位',hide:true}
                ,{field: 'reportStatusStr', title: '上报状态',hide:true,minWidth: 110}
                ,{field: 'returnmsg', title: '错误消息',hide:true}
                ,{field: 'filldepthospital', title: '填写部门院',hide:true}
                ,{field: 'filldepthospitalid', title: '填写部门院编码',hide:true,}
                //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.reportDate,"1");
                //如需转换为HH:mm:ss: return publicMethods.timeData(d.reportDate,"2");
                // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.reportDate);
                ,{field: 'reportDate', title: '上报日期',hide:true,templet: function (d) {
                    return publicMethods.timeData(d.reportDate);
                }}
                ,{field: 'reportReason', title: '中间件操作失败原因',hide:true,}
                ,{
                    fixed: 'right',
                    title: '管理',
                    align:'center',
                    width:100,
                    toolbar: '#wQbdQualityCostRightToolsBar'
                }
            ]],done:function () {
            }
        });

        table.on('tool(wQbdQualityCostTable)', function(obj) {
            var data = obj.data, //获得当前行数据
                    layEvent = obj.event; //获得 lay-event 对应的值
            switch(layEvent){
                case "particulars":
                    var height=publicMethods.layHeight('body');
                    layer.open({
                        type: 2,
                        area: ['96%', height],
                        title: ['质量成本信息详情'],
                        content: serverPath.qbdmsPath + '/qbdms/wQbdQualityCost/view/particulars?id='+data.id + "&isClose=true"
                    });
                    break;
            }
        });

        table.on('checkbox(wQbdQualityCostTable)', function(obj){
            if(obj.type == "all"){
                if(obj.checked){
                    $("input[name='successDataId']").val("");
                    var checkStatus = table.checkStatus('wQbdQualityCostTable');
                    var valArr = checkStatus.data;//选中行数据
                    var ceshiVal = $("input[name='successDataId']").val();
                    for(var i=0;i<valArr.length;i++){
                        ceshiVal =ceshiVal + valArr[i].id + ",";
                    }
                    $("input[name='successDataId']").val(ceshiVal);
                }else{
                    $("input[name='successDataId']").val("");
                }
            }else{
                if(obj.checked){
                    var ceshiVal = $("input[name='successDataId']").val();
                    $("input[name='successDataId']").val(ceshiVal + obj.data.id + ",");
                }else{
                    var ceshiVal = $("input[name='successDataId']").val();
                    var newVal = "";
                    var valArr = ceshiVal.split(obj.data.id+",");
                    for(var i=0;i<valArr.length;i++){
                        newVal += valArr[i];
                    }
                    $("input[name='successDataId']").val(newVal);
                }
            }
        });

    });
</script>
<!--</body>-->
<!--</html>-->